import {
  HTTP
} from '../utils/http'

class ActionModel extends HTTP {
  // 线下活动
  index(current, size,type) {
    return this.request({
      url: 'activity/index',
      data: {
        'size': size || 30,
        'current': current || 1,
        cond:JSON.stringify({
          "type": type
        }),
      }
    })
  }
  banner() {
    return this.request({
      url: 'activity/banner',
    })
  }
  // 其他活动
  comment(current, size) {
    return this.request({
      url: 'activity/comment',
      data: {
        'size': size || 5,
        'current': current || 1,
      }
    })
  }
  // 活动详情
  detail(id) {
    return this.request({
      url: 'activity/detail',
      data: {
        id: id
      },
    })
  }
  //优惠券
  coupon(id, current, size) {
    return this.request({
      url: 'coupon/forIndex',
      data: {
        cond: JSON.stringify({
          "id": id,
          type: 1
        }),
        size: size || 10,
        current: current || 1,
      },
    })
  }
  // 订单
  order(id) {
    return this.request({
      url: 'orders/subOrder',
      data: {
        id: id,
        type: 1,
      }
    })
  }
  // 订单
  courseReview(id) {
    return this.request({
      url: 'activity/getActivityCourse',
      data: {
        id: id,
        currnet:1,
        size:10
      }
    })
  }
  authPay(entityId, entityType, couponId, title, count, totalPrice, realityPrice, mobile, realName, couponPrice, storeName) {
    return this.request({
      url: 'orders/authPay',
      data: {
        entityId: entityId,
        entityType: entityType,
        title: title,
        // couponId:couponId,
        count: count,
        totalPrice: totalPrice,
        realityPrice: realityPrice,
        mobile: mobile,
        realName: realName,
        payType: 2,
        couponPrice: couponPrice,
        storeName: storeName
      }
    })
  }
  authPayFree(entityId, entityType, couponId, title, count, totalPrice, realityPrice, mobile, realName, couponPrice, storeName) {
    return this.request({
      url: 'orders/authPayFree',
      data: {
        entityId: entityId,
        entityType: entityType,
        title: title,
        // couponId:couponId,
        count: count,
        totalPrice: totalPrice,
        realityPrice: realityPrice,
        mobile: mobile,
        realName: realName,
        payType: 2,
        couponPrice: couponPrice,
        storeName: storeName
      }
    })
  }
  //关注
    /**
     * 业务类型 (1:课程 2:活动 3:心声 4:老师 5:商品 6:门店)
     */

  follow(id,type) {
    return this.request({
      url: 'userFollow/insert',
      data: {
        id: id,
        type: type,
      }
    })
  }
  //取消关注
  /**
     * 业务类型 (1:课程 2:活动 3:心声 4:老师 5:商品 6:门店)
     */
  cancelFollow(id,type) {
    return this.request({
      url: 'userFollow/cancelById',
      data: {
        id: id,
        type: type,
      }
    })
  }
}


export {
  ActionModel
}